<template>
  <uni-nav-bar title="实物账户" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
  <view class="package">{{name}}</view>
  <view class="package">
    <view class="space-between"
      @click="navTo('administrator/carFriend/accountDetail?driver_id='+driver_id)">
      <view style="font-weight:500">溶液存量(公斤)</view>
      <view>{{userInfo.amount}} <uni-icons type="forward" size="20"></uni-icons></view>
    </view>
    <view class="space-between top"
      @click="navTo('administrator/carFriend/accountDetail?id='+item.id+'&name='+item.region_name+'&driver_id='+driver_id)"
      v-for="item in userInfo.physical" :key="item.id">
      <view>{{item.region_name}}</view>
      <view class="center">{{item.amount}} <uni-icons type="forward" size="20"></uni-icons></view>
    </view>
  </view>
</template>

<script setup lang="ts">
  import { navBack, navTo } from '@/utils/navigator';
  import { onLoad } from '@dcloudio/uni-app';
  import { ref } from 'vue';
  import { useUserStore } from '@/stores/user';
  const userInfo = useUserStore();
  const name = ref('')
  const driver_id = ref()
  onLoad((pearm) => {
    driver_id.value = Number(pearm.id)
    name.value = pearm.name
    userInfo.Physicalamounte(driver_id.value);
    userInfo.inventory(driver_id.value);
  })
</script>

<style scoped lang="less">
  .top {
    margin-top: 20rpx;
  }
</style>